var api = require("../../../../api.js"),
  app = getApp();
Page({
  data: {
    levelArr: [],
    data:'',
    icons:''
  },
  onLoad: function () {
    let that = this;
    that.setData({
      icons: wx.getStorageSync('site') + '/addons/sd_liferuning/tp/public/uploads/background',
    })
    let _levelArr = [];
    let _maxScore = 2000; // 最大积分
    let _currentScore = 1200;  // 当前积分
    let _progressPercent =  100 / _maxScore * _currentScore;  // 进度条位置
    let _mark = 700 / 100 * _progressPercent - 65 / 2;
    for (let i = 1; i < 6; i++) {
      _levelArr.push({
        defaultImg: that.data.icons+'/resource/common/image/customer/member-center/level' + i + '.png',
        activeImg: that.data.icons +'/resource/common/image/customer/member-center/level' + i + '_1.png',
        needScore: _maxScore / 5 * i
      });
    }
    _this.setData({
      levelArr: _levelArr,
      currentScore: _currentScore,
      progressPercent: _progressPercent,
      mark: _mark
    });
  },
  onShow: function (options) {
    var that = this
    var uid = wx.getStorageSync('uid');
    app.request({
      url: api.member.memberinfo,
      data: '',
      method: 'post',
      success: function (res) {
        console.log('rerere', res.data)
        var data = res.data
        that.setData({
          data: data,
        })
      }
    })
  },
})